export default {
	namespaced: true,
	state: {
		// 0-未开启；1-开启中；2-开启，未扫描；3-开启，扫描中；
		status: 0
	},
	mutations: {
		updateStatus(state, status) {
			state.status = status;
		}
	},
	getters: {
		statusInfo: (state) => {
			const infoObj = {
				status: state.status
			};

			switch (state.status) {
				case 0:
					Object.assign(infoObj, {
						statusTxt: '未开启',
						img: '',
						btnTxt: '开启'
					});
					break;
				case 1:
					Object.assign(infoObj, {
						statusTxt: '开启中...',
						img: '',
						btnTxt: '开启'
					});
					break;
				case 2:
					Object.assign(infoObj, {
						statusTxt: '开启，未扫描',
						img: '-open',
						btnTxt: '关闭'
					});
					break;
				case 3:
					Object.assign(infoObj, {
						statusTxt: '开启，扫描中',
						img: '-open',
						btnTxt: '关闭'
					});
					break;
			}

			return infoObj;
		}
	}
}
